<?php
/**
 * <b>RUBIK IT Solution & Development ltd.</b>
 *
 * PROJECT		: Auction
 * @version 	: 1.1
 * COPYRIGHT    : 2010
 * ------------------------------------------------------
 *
 * Created on	:  Sep 13, 2010
 *
 */

// no direct access
defined ( '_FW_EXEC' ) or die ( 'Restricted access' );
RClassesImporter::cls('controllers.AbstractBackEndController');

/**
 * The controller for State application
 *
 */
class PartnerFrontController extends AbstractBackEndController {

	var $_model;

	function __construct() {
		parent::__construct();
		SysApplication::importModelCls('PartnerModel');
		$this->_model = new PartnerModel();
	}

	function display() {
		$lang = $_REQUEST['lang'];
		$root = SYS_ROOT_URL;
		$model = $this->_model;
		$listPartner = $model->loadPartnerList();

		$who = SysLanguage::_("WHO");
		$partner = SysLanguage::_("PARTNER");
		$showcase = SysLanguage::_("SHOWCASE");
		$member = SysLanguage::_("MEMBER");

		//Load title------------
		$sql = "SELECT * FROM title WHERE id=1";
		$resultTitle = SysDatabase::loadObject($sql);
		if($_REQUEST['lang'] == 'fr'){
			$title = $resultTitle->title_fr;
		} else if($_REQUEST['lang'] == 'en'){
			$title = $resultTitle->title_en;
		}

		$itemPartner = "";
		foreach ($listPartner as $item){
			$id = $item->partner_id;
			$image = $item->image;
			$link = $item->link;
			if($_REQUEST['lang'] == 'fr'){
				$des = strip_tags($item->des_fr);
			} else if($_REQUEST['lang'] == 'en'){
				$des = strip_tags($item->des_en);
			}
			eval('$itemPartner .= "'.SysApplication::loadTemplate('front/itemPartner').'";');
		}
		eval('echo "'.SysApplication::loadTemplate('front/default').'";');
	}
	function details() {
		$root = SYS_ROOT_URL;
		$lang = $_REQUEST['lang'];
		$model = $this->_model;
		$id = SysRequest::getVar('task');
		$result = $model->loadEventDetail($id);
		$image = $result->image;
		$title = $result->title;
		$content = $result->content;
		$service_id = $result->service_id;

		eval('echo "'.SysApplication::loadTemplate('front/serviceDetails').'";');
	}


}
